#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QImage>
#include "x_hiddevice.h"
#include <QButtonGroup>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    int libusb_test(void);

private slots:
    void on_Button_Download_clicked();
    void on_Button_Updata_clicked();
    void on_ProductCode_textChanged(const QString &arg1);

    void on_SerialNumber_textChanged(const QString &arg1);

    void on_SyncCount_textChanged(const QString &arg1);

    void on_IdCode_textChanged(const QString &arg1);

    void on_SeedValue_textChanged(const QString &arg1);

    void on_CB_SeedAdd_stateChanged(int arg1);

    void on_CB_SerialAdd_stateChanged(int arg1);

    void on_CB_IdCodeFromSerial_stateChanged(int arg1);

    void on_CB_ShowPassword_stateChanged(int arg1);

    void SendCmdToDevice(uint8_t* TxBuffer);
    void WriteHcs301(void);
    void WriteHcs301_Config(void);

private:
    Ui::MainWindow *ui;

    QImage* img_led_r;
    QImage* img_led_g;
    QImage* img_led_y;

    X_HidDevice* HcsxxxDevice;

    //单选框的四个分组
    QButtonGroup *btnGroupLearn;
    QButtonGroup *btnGroupBaudRate;
    QButtonGroup *btnGroupVoltageChk;
    QButtonGroup *btnGroupTimer;

    QButtonGroup *btnGroupOverFlow;

    //
    QTimer* CK_UsbDevTim;
    void Timeout_handle(void);

    //读取数据定时器
    QTimer* ReadDataTim;
    void ReadData_handle(void);

public slots:
    void onRadioClickLearn();
    void onRadioClickBaudRate();
    void onRadioClickVoltageChk();
    void onRadioClickTimer();
    void onRadioClickOverFlow();

};
#endif // MAINWINDOW_H
